package cc.telecomdigital.tdstock.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

public class TransparentRelativePanel extends RelativeLayout
{

	private Paint	innerPaint, borderPaint;

	public TransparentRelativePanel(Context context, AttributeSet attrs)
	{
		super(context, attrs);
		init();
	}

	public TransparentRelativePanel(Context context)
	{
		super(context);
		init();
	}

	private void init()
	{
		innerPaint = new Paint(); //b0cccd
		//innerPaint.setARGB(0, 0x00, 0xcc, 0xcd); //gray
		innerPaint.setAlpha(0);
		innerPaint.setAntiAlias(true);
		borderPaint = new Paint();
		borderPaint.setARGB(255, 0x91, 0xb0, 0xab);
		borderPaint.setAntiAlias(true);
		borderPaint.setStyle(Style.STROKE);
		borderPaint.setStrokeWidth(2);
	}

	public void setInnerPaint(Paint innerPaint)
	{
		this.innerPaint = innerPaint;
	}

	public void setBorderPaint(Paint borderPaint)
	{
		this.borderPaint = borderPaint;
	}

	@Override
	protected void dispatchDraw(Canvas canvas)
	{

		RectF drawRect = new RectF();
		drawRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());

		canvas.drawRoundRect(drawRect, 5, 5, innerPaint);
		canvas.drawRoundRect(drawRect, 5, 5, borderPaint);

		super.dispatchDraw(canvas);
	}
}
